package com.consumer.controller;

import com.common.entity.Student;
import com.common.response.ResponseResult;
import com.feignApi.producer.ProducerApi;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @author xin.you
 * @date 2021/4/11
 * @description
 */
@RestController
@RequestMapping("/consumer")
public class ConsumerController {
    @Autowired
    private ProducerApi producerApi;

    @GetMapping("/test1")
    public ResponseResult test1(){
       ResponseResult responseResult = producerApi.test1();
        return responseResult;
    }
    @GetMapping("/test2")
    public ResponseResult test2(String  name){
        System.out.println("this  is  test2");
        return ResponseResult.success(name);
    }
    @GetMapping("/test3")
    public ResponseResult test3(Student  student){
        return ResponseResult.success(student.getName());
    }

    @PostMapping("/test4")
    public ResponseResult test4(String name){
        System.out.println(123);
        return ResponseResult.success(name);
    }
    @PostMapping("/test5")
    public ResponseResult test5(Student student){
        String name = student.getName();
        return ResponseResult.success(name);
    }




}
